//
//  MeTableViewCell.m
//  gushihui
//
//  Created by 甘世清 on 2024/1/24.
//

#import "MeTableViewCell.h"

@implementation MeTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)SQ_Style:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
   
    UIView *bgView = [[UIView alloc]init];
    bgView.layer.cornerRadius = 27;
    bgView.layer.masksToBounds = YES;
    bgView.layer.borderWidth = 1;
    bgView.layer.borderColor = UIColor.whiteColor.CGColor;
    bgView.backgroundColor = SQHexColor(@"#FFFFFF", 0.24);
    [self.contentView addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(12, 29, 0, 29));
    }];
    
    [bgView addSubview:self.leftImage];
    [self.leftImage mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bgView);
        make.left.equalTo(bgView).offset(20);
        make.size.mas_equalTo(24);
    }];
    [bgView addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(bgView);
        make.left.equalTo(bgView).offset(48);
    }];
    UIImageView * image = [[UIImageView alloc]init];
    image.image = SQGetImage(@"箭头");
    image.contentMode = UIViewContentModeScaleAspectFit;
    [bgView addSubview:image];
    [image mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(24);
            make.centerY.equalTo(bgView);
            make.right.equalTo(bgView.mas_right).offset(-16);
    }];
 
}
- (void)setName:(NSString *)name{
    _name = name;
    self.leftImage.image = SQGetImage(name);
    self.nameLabel.text = SQNSLocalString(name);
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

 
- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.font = FONT_BOLD(16);
        _nameLabel.textColor = SQColorF5F5F5;
       
    }
    return _nameLabel;
}
- (UIImageView *)leftImage{
    if (!_leftImage) {
        _leftImage = [[UIImageView alloc]init];
        _leftImage.contentMode = UIViewContentModeScaleAspectFit;
    }
    return _leftImage;
}
@end
